/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package kn.cstf2.transition.Client;

import com.opensymphony.xwork2.ActionContext;
import com.opensymphony.xwork2.ActionSupport;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Map;
import java.util.logging.Level;
import kn.cstf2.assign.Client.MailSender;
import kn.cstf2.assign.Shared.AssignShared;
import kn.cstf2.global.Utils.ConexionFtp;
import kn.cstf2.global.Utils.CstF2Exception;
import kn.cstf2.global.Utils.MyReportCreator;
import kn.cstf2.implementation.Shared.ImplementationShared;
import kn.cstf2.main.Server.MainServer;
import kn.cstf2.main.Shared.MainShared;
import kn.cstf2.transition.Bean.*;
import kn.cstf2.transition.Server.TransitionServer;
import kn.cstf2.transition.Shared.TransitionShared;
import kn.mx.cstf2.dto.UsuarioDto;

import org.apache.log4j.Logger;

public class TransitionClient extends ActionSupport {

    private String TRANSITION = "transition";
    private String PDF = "pdf";
    private String ZIP = "zip";
    private String UPLOAD = "upload";
    private String ERROR_DOWN = "errorFileTransition";
    private String knkey;
    private TransitionBean transitionBeanM = new TransitionBean();
    private File archivo1, archivo2, archivo3, archivo4, archivo5, archivo6, archivo7, archivo8;
    private ArrayList<String> statusList = new ArrayList<String>();
    private ArrayList<String> personList = new ArrayList<String>();
    private ArrayList<PersonalBean> detallesPersonD;
    private ArrayList<PersonalBean> newArrayPerson;
    private Integer idDownloadFtp = 0;
    private String ClientInfo = new String();
    private String CorreoIfOwnerInfo = new String();
    private static Logger log = Logger.getLogger(TransitionClient.class);
    public static final String ERROR_SESSION = "errorSession";
    public static final String ERROR_KNKEY = "errorKnkey";
    private int index = 0;
    private String status;
    private String datos = "";
    private String person = new String();
    private PersonalBean pb = new PersonalBean();
    private TransitionBean transitionBean = new TransitionBean();
    private UsuarioDto usuarioT = new UsuarioDto();
    private InputStream pdfInputStream;
    private Boolean box1;
    private Boolean box2;
    private Boolean box3;
    private Boolean box4;
    private Boolean box5;
    private Boolean box6;
    private Boolean box7;
    private Boolean box8;
    private Boolean box1aux;
    private Boolean box2aux;
    private Boolean box3aux;
    private Boolean box4aux;
    private Boolean box5aux;
    private Boolean box6aux;
    private Boolean box7aux;
    private Boolean box8aux;
    private Boolean valBranch;
    private String msjBranch ;
    private ArrayList<Boolean> voBos;
    private Integer documentId = 0;
    private Integer KNKEY;
    private ArrayList<Localidad> branch = new ArrayList<Localidad>();
    private String locality;
    private Boolean existe1;
    private Boolean existe2;
    private Boolean existe3;
    private Boolean existe4;
    private Boolean existe5;
    private Boolean existe6;

    public void TransitionClient() {
        statusList.add("On Hold");
        statusList.add("On Going");
        statusList.add("Canceled");
        statusList.add("Closed");
        statusList.add("Completed");

    }

    @Override
    public String execute() {
        UsuarioDto usuario = new UsuarioDto();
        try {
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");


            if (transitionBeanM.getKnkey() == null) {
                CstF2Exception ex = new CstF2Exception();
                log.error("ERROR. ", ex);
                addFieldError("Not Knkey Found", "PorFavor Seleccione una Knkey: " + ex.getMessage());
                MainShared mainShared = new MainShared();
                setTransitionBeanArray(mainShared.GetTransitionBeanArrayIdKnkey(usuario));

                return ERROR_KNKEY;
            }

            statusList.add("On Hold");
            statusList.add("On Going");
            statusList.add("Canceled");
            statusList.add("Closed");
            statusList.add("Completed");

            TransitionBean transitionBeanNew = new TransitionBean();
            TransitionShared transitionShared = new TransitionShared();
            TransitionServer transitionServer = new TransitionServer();

            personList = transitionShared.GetListaNombreDePersonal();

            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanNew.setTime(transitionShared.GetTheDateTime());

            transitionBeanM = transitionBeanNew;
            usuarioT.setName(usuario.getName());
            ImplementationShared implementationShared = new ImplementationShared();


            statusselected = transitionShared.GetStatusSelected(transitionBeanM.getKnkey());

            DocumentsBean documentsBean = new DocumentsBean();
            JoindocumenttransitionBean joindocumenttransitionBean = new JoindocumenttransitionBean();

            documentsBean = transitionShared.GetDocumentName(transitionBeanM);
            
            //////////////Valida los archivos cargados
            if(transitionServer.verifyUploaded("Customer Profile", transitionBeanM.getKnkey())){
                existe1 = true;
            }
            if(transitionServer.verifyUploaded("rfc", transitionBeanM.getKnkey())){
                existe2 = true;
            }
            if(transitionServer.verifyUploaded("R1", transitionBeanM.getKnkey())){
                existe3 = true;
            }
            if(transitionServer.verifyUploaded("R2", transitionBeanM.getKnkey())){
                existe4 = true;
            }
            if(transitionServer.verifyUploaded("Minimum Selling Rates", transitionBeanM.getKnkey())){
                existe5 = true;
            }
            if(transitionServer.verifyUploaded("Sales Quotation", transitionBeanM.getKnkey())){
                existe6 = true;
            }


            if (joindocumenttransitionBean == null) {
                log.info("Esta transaccion no ha sido generada, escoja una KnKey diferente.");
                addFieldError("+++loginIncorrecto", "Esta transaccion no ha sido generada,JoinDocumentTransition esta vacia porque no hay relacion en la base de datos, escoja una KnKey diferente.");
                return ERROR_SESSION;
            } else {
                //llena los texfields de attachments    
                transitionBean.setAcondebtornumbertext(transitionShared.GetJoindocumenttransitionDetail(8, transitionBeanM.getId()));
                transitionBean.setRatetrackertext(transitionShared.GetJoindocumenttransitionDetail(6, transitionBeanM.getId()));

                //////////////rellena la pantalla transitionLog
                String TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());
                if (TlogDB == null) {
                    transitionBeanM.setTlog("");
                    transitionShared.UpdateLogEnTransition(transitionBeanM);
                    TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());

                    setDatos(usuario.getName() + "  " + transitionShared.GetTheDateTime() + "  " + TlogDB);
                } else {
                    setDatos(TlogDB);
                }

                /////rellena las pantallas de Client Info e If Owner Info
                setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
                AsignIfownerStkBean hghg = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
                if (hghg != null) {
                    setCorreoIfOwnerInfo(hghg.getIfownwer());
                }

                //rellena los checkbox de attachments
                joindocumenttransitionBean = (transitionShared.GetVoBoInJoindocumenttransition(transitionBeanM.getId()));
                voBos = joindocumenttransitionBean.getCheckboxesVoBo();
                box1 = voBos.get(0);
                box2 = voBos.get(1);
                box3 = voBos.get(2);
                box4 = voBos.get(3);
                box5 = voBos.get(4);
                box6 = voBos.get(5);
                box7 = voBos.get(6);
                box8 = voBos.get(7);

                box1aux = box1;
                box2aux = box2;
                box3aux = box3;
                box4aux = box4;
                box5aux = box5;
                box6aux = box6;
                box7aux = box7;
                box8aux = box8;

                //rellena la tabla dunamica de operations information
                detallesPersonD = transitionShared.GetDataPersonalByIdPersonal(transitionBeanM.getId());

            }

        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }

        if (usuario.getName().trim().equals("STK")) {
            return "knkeylist";
        } else {
            return SUCCESS;
        }
    }

    public String insertComment() {
        statusList.add("On Hold");
        statusList.add("On Going");
        statusList.add("Canceled");
        statusList.add("Closed");
        statusList.add("Completed");
        UsuarioDto usuario = new UsuarioDto();

        try {
            if (transitionBeanM != null) {
                ActionContext contexto = ActionContext.getContext();
                Map<String, Object> sesion = contexto.getSession();
                usuario = (UsuarioDto) sesion.get("usuarioSession");
                Map<String, Object> sesion2 = contexto.getSession();
                transitionBeanM = (TransitionBean) sesion2.get("Knkey");

                TransitionBean transitionBeanNew = new TransitionBean();
                TransitionShared transitionShared = new TransitionShared();
                TransitionServer transitionServer = new TransitionServer();
                MainServer mainServer = new MainServer();
                transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);

                //guarda el tlog cachado desde el jsp
                transitionBeanNew.setTlog(transitionBean.getTlog());

                transitionBeanNew.setTime(transitionShared.GetTheDateTime());
                transitionBean = transitionBeanNew;

                String Nombre = usuario.getName().trim();
                if(sesion.get("nombreSTK")!= null && Nombre.trim().equals("STK")){
                    Nombre = sesion.get("nombreSTK") + " STK";
                }
                String Fecha = String.valueOf(transitionBean.getTime());
                String tlogy = transitionBean.getTlog();

                String DatosActuales = Nombre + " " + Fecha + " " + tlogy + "\n";

                String TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());
                if (TlogDB == null) {
                    transitionBean.setTlog(DatosActuales);
                    transitionShared.UpdateLogEnTransition(transitionBean);
                    TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());
                    setDatos(TlogDB + " \n");
                } else {
                    setDatos(TlogDB + DatosActuales + " \n");
                    transitionBean.setTlog(TlogDB + " " + DatosActuales + "\n");
                    transitionShared.UpdateLogEnTransition(transitionBean);
                }

                statusselected = transitionShared.GetStatusSelected(transitionBean.getKnkey());
                personList = transitionShared.GetListaNombreDePersonal();

                /////rellena las pantallas de Client Info e If Owner Info
                setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
                AsignIfownerStkBean bean = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
                if (bean != null) {
                    setCorreoIfOwnerInfo(bean.getIfownwer());
                }

                detallesPersonD = transitionShared.GetDataPersonalByIdPersonal(transitionBean.getId());
                
                //////////////Valida los archivos cargados
                if(transitionServer.verifyUploaded("Customer Profile", transitionBeanM.getKnkey())){
                    existe1 = true;
                }
                if(transitionServer.verifyUploaded("rfc", transitionBeanM.getKnkey())){
                    existe2 = true;
                }
                if(transitionServer.verifyUploaded("R1", transitionBeanM.getKnkey())){
                    existe3 = true;
                }
                if(transitionServer.verifyUploaded("R2", transitionBeanM.getKnkey())){
                    existe4 = true;
                }
                if(transitionServer.verifyUploaded("Minimum Selling Rates", transitionBeanM.getKnkey())){
                    existe5 = true;
                }
                if(transitionServer.verifyUploaded("Sales Quotation", transitionBeanM.getKnkey())){
                    existe6 = true;
                }
                
                //////////////rellena el branch
                branch = transitionServer.branch();
                valBranch = true;
                String msj = transitionServer.getLocality(transitionBeanM.getKnkey());
                if(msj != null)
                    msjBranch = transitionServer.validateBranch(transitionBeanM.getKnkey()) + msj;
                
                //////////////Cambia el status
                mainServer.updatedTrue(transitionBeanM.getKnkey());
                mainServer.updatedTrue1(transitionBeanM.getKnkey());

                //rellena los checkbox de attachments
                JoindocumenttransitionBean joindocumenttransitionBean = new JoindocumenttransitionBean();
                joindocumenttransitionBean = (transitionShared.GetVoBoInJoindocumenttransition(transitionBean.getId()));
                voBos = joindocumenttransitionBean.getCheckboxesVoBo();
                box1 = voBos.get(0);
                box2 = voBos.get(1);
                box3 = voBos.get(2);
                box4 = voBos.get(3);
                box5 = voBos.get(4);
                box6 = voBos.get(5);
                box7 = voBos.get(6);
                box8 = voBos.get(7);

                //llena los texfields de attachments    
                joindocumenttransitionBean = transitionShared.GetJoindocumenttransitionData(transitionBean);
                transitionBean.setAcondebtornumbertext(transitionShared.GetJoindocumenttransitionDetail(8, transitionBean.getId()));
                transitionBean.setRatetrackertext(transitionShared.GetJoindocumenttransitionDetail(6, transitionBean.getId()));


            } else {
                log.info("No hay Knkeys asignadas.");
                addFieldError("KnkeyIncorrecta", "No hay Knkeys asignadas.");
                return ERROR_SESSION;
            }
        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }

        if (usuario.getName().equals("STK                      ")) {
            return "knkeylist";
        } else {
            return TRANSITION;
        }
    }

    public void insertCommentEachAction(String comment) {

        if (transitionBeanM != null) {
            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionBean transitionBeanNew = new TransitionBean();
            TransitionShared transitionShared = new TransitionShared();
            TransitionServer transitionServer = new TransitionServer();
            MainServer mainServer = new MainServer();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);

            //guarda el tlog cachado desde el jsp
            transitionBeanNew.setTlog(transitionBean.getTlog());

            transitionBeanNew.setTime(transitionShared.GetTheDateTime());
            transitionBean = transitionBeanNew;
            transitionBeanM = transitionBeanNew;

            transitionBean.setAcondebtornumbertext(transitionShared.GetJoindocumenttransitionDetail(8, transitionBeanM.getId()));
            transitionBean.setRatetrackertext(transitionShared.GetJoindocumenttransitionDetail(6, transitionBeanM.getId()));

            String Nombre = usuario.getName();
            String Fecha = String.valueOf(transitionBean.getTime());

            String DatosActuales = Nombre.trim() + " " + Fecha + " " + comment + "\n";
            
            //////////////rellena el branch
            branch = transitionServer.branch();
            valBranch = true;
            String msj = transitionServer.getLocality(transitionBeanM.getKnkey());
            if(msj != null)
                msjBranch = transitionServer.validateBranch(transitionBeanM.getKnkey()) + msj;

            //////////////Cambia el status
            mainServer.updatedTrue(transitionBeanM.getKnkey());
            mainServer.updatedTrue1(transitionBeanM.getKnkey());
            
            //////////////Valida los archivos cargados
            if(transitionServer.verifyUploaded("Customer Profile", transitionBeanM.getKnkey())){
                existe1 = true;
            }
            if(transitionServer.verifyUploaded("rfc", transitionBeanM.getKnkey())){
                existe2 = true;
            }
            if(transitionServer.verifyUploaded("R1", transitionBeanM.getKnkey())){
                existe3 = true;
            }
            if(transitionServer.verifyUploaded("R2", transitionBeanM.getKnkey())){
                existe4 = true;
            }
            if(transitionServer.verifyUploaded("Minimum Selling Rates", transitionBeanM.getKnkey())){
                existe5 = true;
            }
            if(transitionServer.verifyUploaded("Sales Quotation", transitionBeanM.getKnkey())){
                existe6 = true;
            }

            String TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());
            if (TlogDB == null) {
                transitionBean.setTlog(DatosActuales);
                transitionShared.UpdateLogEnTransition(transitionBean);
                TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());
                setDatos(TlogDB + " \n");
            } else {
                setDatos(TlogDB + DatosActuales + " \n");
                transitionBean.setTlog(TlogDB + " " + DatosActuales + "\n");
                transitionShared.UpdateLogEnTransition(transitionBean);
            }
        }
    }

    public String insertStatus() {
        UsuarioDto usuario = new UsuarioDto();
        try {
            statusList.add("On Hold");
            statusList.add("On Going");
            statusList.add("Canceled");
            statusList.add("Closed");
            statusList.add("Completed");

            if (transitionBeanM != null) {
                ActionContext contexto = ActionContext.getContext();
                Map<String, Object> sesion = contexto.getSession();
                usuario = (UsuarioDto) sesion.get("usuarioSession");
                Map<String, Object> sesion2 = contexto.getSession();
                transitionBeanM = (TransitionBean) sesion2.get("Knkey");

                TransitionBean transitionBeanNew = new TransitionBean();
                TransitionShared transitionShared = new TransitionShared();
                TransitionServer transitionServer = new TransitionServer();
                MainServer mainServer = new MainServer();
                transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);

                transitionBeanM = transitionBeanNew;   // aki empieza la confusion entre transitionBean y tansitionBeanM el primero con datos del jso y el otro con knkey e id

                usuarioT.setName(usuario.getName());

                transitionBeanM.setStatus(status);

                //transitionBean=transitionBeanNew;
                transitionShared.UpdateStatusEnTransition(transitionBeanM);

                setDatos(usuario.getName() + "  " + transitionShared.GetTheDateTime() + "   " + transitionBeanM.getTlog());

                personList = transitionShared.GetListaNombreDePersonal();
                statusselected = transitionShared.GetStatusSelected(transitionBeanM.getKnkey());


                /////rellena las pantallas de Client Info e If Owner Info
                setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
                AsignIfownerStkBean bean = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
                if (bean != null) {
                    setCorreoIfOwnerInfo(bean.getIfownwer());
                }

                ////////Agrega en Tlog la accion hecha en este medoto
                insertCommentEachAction("Se Inserto un nuevo status de transition " + status);

                //rellena la tabla dinamica operations information
                detallesPersonD = transitionShared.GetDataPersonalByIdPersonal(transitionBean.getId());

                //rellena los checkbox de attachments
                JoindocumenttransitionBean joindocumenttransitionBean = new JoindocumenttransitionBean();
                joindocumenttransitionBean = (transitionShared.GetVoBoInJoindocumenttransition(transitionBean.getId()));
                voBos = joindocumenttransitionBean.getCheckboxesVoBo();
                box1 = voBos.get(0);
                box2 = voBos.get(1);
                box3 = voBos.get(2);
                box4 = voBos.get(3);
                box5 = voBos.get(4);
                box6 = voBos.get(5);
                box7 = voBos.get(6);
                box8 = voBos.get(7);

                //llena los texfields de attachments    
                joindocumenttransitionBean = transitionShared.GetJoindocumenttransitionData(transitionBean);
                
                //////////////rellena el branch
                branch = transitionServer.branch();
                valBranch = true;
                String msj = transitionServer.getLocality(transitionBeanM.getKnkey());
                if(msj != null)
                    msjBranch = transitionServer.validateBranch(transitionBeanM.getKnkey()) + msj;
                
                //////////////Cambia el status
                mainServer.updatedTrue(transitionBeanM.getKnkey());
                mainServer.updatedTrue1(transitionBeanM.getKnkey());
                
                //////////////Valida los archivos cargados
                if(transitionServer.verifyUploaded("Customer Profile", transitionBeanM.getKnkey())){
                    existe1 = true;
                }
                if(transitionServer.verifyUploaded("rfc", transitionBeanM.getKnkey())){
                    existe2 = true;
                }
                if(transitionServer.verifyUploaded("R1", transitionBeanM.getKnkey())){
                    existe3 = true;
                }
                if(transitionServer.verifyUploaded("R2", transitionBeanM.getKnkey())){
                    existe4 = true;
                }
                if(transitionServer.verifyUploaded("Minimum Selling Rates", transitionBeanM.getKnkey())){
                    existe5 = true;
                }
                if(transitionServer.verifyUploaded("Sales Quotation", transitionBeanM.getKnkey())){
                    existe6 = true;
                }
                
                
                //////////////rellena la pantalla transitionLog
                String TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());
                if (TlogDB == null) {
                    transitionBean.setTlog("");
                    transitionShared.UpdateLogEnTransition(transitionBean);
                    TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());

                    setDatos(usuario.getName() + "  " + transitionShared.GetTheDateTime() + "  " + TlogDB);
                } else {
                    setDatos(TlogDB);
                }


            } else {
                log.info("No hay Knkeys asignadas.");
                addFieldError("KnkeyIncorrecta", "No hay Knkeys asignadas.");
                return ERROR_SESSION;
            }



        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }

        if (usuario.getName().equals("STK                      ")) {
            return "knkeylist";
        } else {
            return SUCCESS;
        }
    }

    public String AgregayValidaNamePersonalM() {
        UsuarioDto usuario = new UsuarioDto();
        //DATOS DEL PERSONAL EXISTENTES EN LA BASE DE DATOS DEL COMBOBOX DEL POP UP
        try {
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            statusList.add("On Hold");
            statusList.add("On Going");
            statusList.add("Canceled");
            statusList.add("Closed");
            statusList.add("Completed");

            TransitionShared transitionShared = new TransitionShared("");
            PersonalBean p = new PersonalBean();
            p = transitionShared.GetDataPersonalByName(person);

            p.setKnkey(transitionBeanM.getKnkey());


            //////////////rellena la pantalla transitionLog
            String TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());
            if (TlogDB == null) {
                transitionBean.setTlog("");
                transitionShared.UpdateLogEnTransition(transitionBean);
                TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());

                setDatos(usuario.getName() + "  " + transitionShared.GetTheDateTime() + "  " + TlogDB);
            } else {
                setDatos(TlogDB);
            }

            /////rellena las pantallas de Client Info e If Owner Info
            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean bean = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (bean != null) {
                setCorreoIfOwnerInfo(bean.getIfownwer());
            }

            personList = transitionShared.GetListaNombreDePersonal();

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBean = transitionBeanNew;

            transitionShared.SetJoinPersonTransition(p, transitionBean);
            statusselected = transitionShared.GetStatusSelected(transitionBean.getKnkey());

            //rellena la abla dinamica operation informations
            detallesPersonD = transitionShared.GetDataPersonalByIdPersonal(transitionBean.getId());

            //rellena los checkbox de attachments
            JoindocumenttransitionBean joindocumenttransitionBean = new JoindocumenttransitionBean();
            joindocumenttransitionBean = (transitionShared.GetVoBoInJoindocumenttransition(transitionBean.getId()));
            voBos = joindocumenttransitionBean.getCheckboxesVoBo();
            box1 = voBos.get(0);
            box2 = voBos.get(1);
            box3 = voBos.get(2);
            box4 = voBos.get(3);
            box5 = voBos.get(4);
            box6 = voBos.get(5);
            box7 = voBos.get(6);
            box8 = voBos.get(7);

            //llena los texfields de attachments    
            joindocumenttransitionBean = transitionShared.GetJoindocumenttransitionData(transitionBean);
            transitionBean.setAcondebtornumbertext(joindocumenttransitionBean.getDetails());
            transitionBean.setRatetrackertext(joindocumenttransitionBean.getDetails());


            ////////Agrega en Tlog la accion hecha en este medoto
            insertCommentEachAction("Se Inserto una persona de la base de datos:" + " - " + person);

        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }

        if (usuario.getName().equals("STK                      ")) {
            return "knkeylist";
        } else {
            return SUCCESS;
        }
    }

    public String validaNamePersonalMExiste() {
        UsuarioDto usuario = new UsuarioDto();
        //DATOS NUEVOS DEL PERSONAL AGREGADOS EN LOS CAMPOS DEL POP UP 
        try {
            statusList.add("On Hold");
            statusList.add("On Going");
            statusList.add("Canceled");
            statusList.add("Closed");
            statusList.add("Completed");

            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared("");
            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            PersonalBean p = new PersonalBean();

            p = transitionShared.GetDataPersonalByEmail(pb.getEmail());
            statusselected = transitionShared.GetStatusSelected(transitionBeanM.getKnkey());

            if (p != null) {
                p = transitionShared.GetDataPersonalByEmail(pb.getEmail());


                //////////////rellena la pantalla transitionLog
                String TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());
                if (TlogDB == null) {
                    transitionBean.setTlog("");
                    transitionShared.UpdateLogEnTransition(transitionBean);
                    TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());

                    setDatos(usuario.getName() + "  " + transitionShared.GetTheDateTime() + "  " + TlogDB);
                } else {
                    setDatos(TlogDB);
                }

                /////rellena las pantallas de Client Info e If Owner Info
                setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
                AsignIfownerStkBean bean = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
                if (bean != null) {
                    setCorreoIfOwnerInfo(bean.getIfownwer());
                }

                personList = transitionShared.GetListaNombreDePersonal();

                transitionShared.SetJoinPersonTransition(p, transitionBeanM);

                JoindocumenttransitionBean joindocumenttransitionBean = new JoindocumenttransitionBean();
                joindocumenttransitionBean = transitionShared.GetJoindocumenttransitionData(transitionBeanM);

                transitionBeanM.setAcondebtornumbertext(joindocumenttransitionBean.getDetails());
                transitionBeanM.setRatetrackertext(joindocumenttransitionBean.getDetails());

                //rellnea la tabla dinamica de operation information
                detallesPersonD = transitionShared.GetDataPersonalByIdPersonal(transitionBeanM.getId());
                
                ////////Agrega en Tlog la accion hecha en este medoto
                insertCommentEachAction("Se Inserto una nueva persona a la base de datos:" + " - " + pb.getName() + " - " + pb.getEmail());

            } else {
                pb.setKnkey(transitionBeanM.getKnkey());
                transitionShared.InsertDataPersonal(pb);

                p = transitionShared.GetDataPersonalByName(pb.getName());
                //detallesPersonD =new ArrayList<PersonalBean>();
                //transitionShared.SetJoinPersonTransition(p, transitionBeanM) ;  // al parecer esta repetido xq se agrega dos veces a la tabla joinpersontarnbsitioj

                //////////////rellena la pantalla transitionLog
                String TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());
                if (TlogDB == null) {
                    transitionBean.setTlog("");
                    transitionShared.UpdateLogEnTransition(transitionBean);
                    TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());

                    setDatos(usuario.getName() + "  " + transitionShared.GetTheDateTime() + "  " + TlogDB);
                } else {
                    setDatos(TlogDB);
                }

                /////rellena las pantallas de Client Info e If Owner Info
                setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
                AsignIfownerStkBean bean = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
                if (bean != null) {
                    setCorreoIfOwnerInfo(bean.getIfownwer());
                }

                personList = transitionShared.GetListaNombreDePersonal();

                transitionShared.SetJoinPersonTransition(p, transitionBeanM);

                JoindocumenttransitionBean joindocumenttransitionBean = new JoindocumenttransitionBean();
                joindocumenttransitionBean = transitionShared.GetJoindocumenttransitionData(transitionBeanM);

                transitionBeanM.setAcondebtornumbertext(joindocumenttransitionBean.getDetails());
                transitionBeanM.setRatetrackertext(joindocumenttransitionBean.getDetails());

                detallesPersonD = transitionShared.GetDataPersonalByIdPersonal(transitionBeanM.getId());

                //rellena los checkbox de attachments
                joindocumenttransitionBean = (transitionShared.GetVoBoInJoindocumenttransition(transitionBeanM.getId()));
                voBos = joindocumenttransitionBean.getCheckboxesVoBo();
                box1 = voBos.get(0);
                box2 = voBos.get(1);
                box3 = voBos.get(2);
                box4 = voBos.get(3);
                box5 = voBos.get(4);
                box6 = voBos.get(5);
                box7 = voBos.get(6);
                box8 = voBos.get(7);

                ////////Agrega en Tlog la accion hecha en este medoto
                insertCommentEachAction("Se Inserto una nueva persona a la base de datos:" + " - " + pb.getName() + " - " + pb.getEmail());


            }
        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }

        if (usuario.getName().equals("STK                      ")) {
            return "knkeylist";
        } else {
            return SUCCESS;
        }
    }

    public String EliminarListaDetallesPersonD() {
        try {
            statusList.add("On Hold");
            statusList.add("On Going");
            statusList.add("Canceled");
            statusList.add("Closed");
            statusList.add("Completed");

            UsuarioDto usuario = new UsuarioDto();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            usuario = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            TransitionShared transitionShared = new TransitionShared("");

            TransitionBean transitionBeanNew = new TransitionBean();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBeanM = transitionBeanNew;

            JoinPersonTransitionBean idperson = new JoinPersonTransitionBean();
            detallesPersonD = transitionShared.GetDataPersonalByIdPersonal(transitionBeanM.getId());
            idperson.setIdperson(detallesPersonD.get(index).getId());
            transitionShared.DeleteRelationJoinusertransitionByIdPerson(detallesPersonD.get(index).getId(), transitionBeanM.getId());

            statusselected = transitionShared.GetStatusSelected(transitionBeanM.getKnkey());

            //  cone sto se sabe el nombre d ela persona que se va a eliminar
            PersonalBean personalBeanEliminado = transitionShared.GetDataPersonalById(idperson.getIdperson());
            String nombreEliminado = personalBeanEliminado.getName();


            int veryf = transitionShared.VerificarCountJoinPersontransition(idperson);
            if (veryf == 0) {
                PersonalBean pb = new PersonalBean();
                pb.setId(detallesPersonD.get(index).getId());
                transitionShared.DeletePersonalById(pb);
            } else {
            }


            /////rellena las pantallas de Client Info e If Owner Info
            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean bean = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (bean != null) {
                setCorreoIfOwnerInfo(bean.getIfownwer());
            }

            String TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());
            if (TlogDB == null) {
                transitionBean.setTlog("");
                transitionShared.UpdateLogEnTransition(transitionBean);
                TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());

                setDatos(usuario.getName() + "  " + transitionShared.GetTheDateTime() + "  " + TlogDB);
            } else {
                setDatos(TlogDB);
            }

            personList = transitionShared.GetListaNombreDePersonal();

            JoindocumenttransitionBean joindocumenttransitionBean = new JoindocumenttransitionBean();
            joindocumenttransitionBean = transitionShared.GetJoindocumenttransitionData(transitionBeanM);

            transitionBeanM.setAcondebtornumbertext(joindocumenttransitionBean.getDetails());
            transitionBeanM.setRatetrackertext(joindocumenttransitionBean.getDetails());

            detallesPersonD = transitionShared.GetDataPersonalByIdPersonal(transitionBeanM.getId());

            //rellena los checkbox de attachments
            joindocumenttransitionBean = (transitionShared.GetVoBoInJoindocumenttransition(transitionBeanM.getId()));
            voBos = joindocumenttransitionBean.getCheckboxesVoBo();
            box1 = voBos.get(0);
            box2 = voBos.get(1);
            box3 = voBos.get(2);
            box4 = voBos.get(3);
            box5 = voBos.get(4);
            box6 = voBos.get(5);
            box7 = voBos.get(6);
            box8 = voBos.get(7);

            ////////Agrega en Tlog la accion hecha en este medoto
            insertCommentEachAction("Se Elimino una persona de la base de datos:" + " - " + nombreEliminado);

            if (usuario.getName().equals("STK                      ")) {
            return "knkeylist";
        } else {
            return SUCCESS;
        }

        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }
        
    }

    public String GenerarReportePDF() throws FileNotFoundException {
        try {
            statusList.add("On Hold");
            statusList.add("On Going");
            statusList.add("Canceled");
            statusList.add("Closed");
            statusList.add("Completed");

            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion.get("Knkey");

            MyReportCreator myRCPDF = new MyReportCreator();
            pdfInputStream = myRCPDF.generarReporte(transitionBeanM.getKnkey());

            insertCommentEachAction("Se descargo el log a un archivo PDF");

            ////////////////rellena nuevamente la lista de usuarios para q no se pierda en el metodo generarreportepdf
            UsuarioDto usuario = new UsuarioDto();
            Map<String, Object> sesion2 = contexto.getSession();
            usuario = (UsuarioDto) sesion2.get("usuarioSession");
            TransitionBean transitionBeanNew = new TransitionBean();
            TransitionShared transitionShared = new TransitionShared();
            TransitionServer transitionServer = new TransitionServer();
            MainServer mainServer = new MainServer();
            personList = transitionShared.GetListaNombreDePersonal();
            transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
            transitionBean = transitionBeanNew;
            usuarioT.setName(usuario.getName());
            transitionBean.setTime(transitionBean.getTime());
            transitionShared.GetDocumentName(transitionBean);
            transitionShared.GetJoindocumenttransitionData(transitionBean);
            String TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());

            /////rellena las pantallas de Client Info e If Owner Info
            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean bean = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (bean != null) {
                setCorreoIfOwnerInfo(bean.getIfownwer());
            }
            
            //////////////rellena el branch
            branch = transitionServer.branch();
            valBranch = true;
            String msj = transitionServer.getLocality(transitionBeanM.getKnkey());
            if(msj != null)
                msjBranch = transitionServer.validateBranch(transitionBeanM.getKnkey()) + msj;

            //////////////Cambia el status
            mainServer.updatedTrue(transitionBeanM.getKnkey());
            mainServer.updatedTrue1(transitionBeanM.getKnkey());

            statusselected = transitionShared.GetStatusSelected(transitionBeanM.getKnkey());

            if (TlogDB == null) {
                transitionBean.setTlog("");
                transitionShared.UpdateLogEnTransition(transitionBean);
                TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());
                setDatos(usuario.getName() + "  " + transitionShared.GetTheDateTime() + "  " + TlogDB);
            } else {
                setDatos(TlogDB);
            }
        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
        }
        return PDF;
    }

    private void uploadFtp(File archivo, String fileType) {
        try {
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            ConexionFtp conexionFtp = new ConexionFtp();
            TransitionServer transitionServer = new TransitionServer();
            InputStream entrada = new FileInputStream(archivo);
            conexionFtp.guarda(transitionBeanM.getKnkey() + ".7z", fileType + "/", entrada);
            
            //////////////Valida los archivos cargados
            if(transitionServer.verifyUploaded("Customer Profile", transitionBeanM.getKnkey())){
                existe1 = true;
            }
            if(transitionServer.verifyUploaded("rfc", transitionBeanM.getKnkey())){
                existe2 = true;
            }
            if(transitionServer.verifyUploaded("R1", transitionBeanM.getKnkey())){
                existe3 = true;
            }
            if(transitionServer.verifyUploaded("R2", transitionBeanM.getKnkey())){
                existe4 = true;
            }
            if(transitionServer.verifyUploaded("Minimum Selling Rates", transitionBeanM.getKnkey())){
                existe5 = true;
            }
            if(transitionServer.verifyUploaded("Sales Quotation", transitionBeanM.getKnkey())){
                existe6 = true;
            }

        } catch (Exception ex) {
            log.error("Error al cargar: ", ex);
            addFieldError("", "Ocurrio un Error: " + ex.getMessage());
        }
    }

    private void borraFtp(String fileType) {
        try {
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");

            ConexionFtp conexionFtp = new ConexionFtp();
            conexionFtp.borra(transitionBeanM.getKnkey() + ".7z", fileType + "/");

        } catch (Exception ex) {
            log.error("Error al cargar: ", ex);
            addFieldError("", "Ocurrio un Error: " + ex.getMessage());
        }
    }
    
    public void activeMessage(String file){
            addFieldError("file", "El archivo " + file + " ya ha sido agregado");
    }

    public String executeUpload() {
        statusList.add("On Hold");
        statusList.add("On Going");
        statusList.add("Canceled");
        statusList.add("Closed");
        statusList.add("Completed");

        TransitionShared transitionShared = new TransitionShared();
        TransitionServer transitionServer = new TransitionServer();
        MainServer mainServer = new MainServer();
        UsuarioDto user = new UsuarioDto();
        ActionContext contexto = ActionContext.getContext();
        Map<String, Object> sesion = contexto.getSession();
        user = (UsuarioDto) sesion.get("usuarioSession");
        Map<String, Object> sesion2 = contexto.getSession();
        transitionBeanM = (TransitionBean) sesion2.get("Knkey");
        branch = transitionServer.branch();
        valBranch = true;
        String msj = transitionServer.getLocality(transitionBeanM.getKnkey());
        if(msj != null)
            msjBranch = transitionServer.validateBranch(transitionBeanM.getKnkey()) + msj;
        mainServer.updatedTrue(transitionBeanM.getKnkey());
        mainServer.updatedTrue1(transitionBeanM.getKnkey());
        

        if (archivo1 != null) {
            if (transitionShared.fileUploaded("Customer Profile", transitionBeanM.getKnkey())) {
                borraFtp("customer_profile");
            }
            
            uploadFtp(archivo1, "customer_profile");
            transitionShared.updateUploaded("Customer Profile", transitionBeanM.getKnkey());
            
            insertCommentEachAction("El archivo Customer Profile se cargo correctamente");
        }
        if (archivo2 != null) {
            if (transitionShared.fileUploaded("rfc", transitionBeanM.getKnkey())) {
                borraFtp("rfc");
            }

            uploadFtp(archivo2, "rfc");
            transitionShared.updateUploaded("rfc", transitionBeanM.getKnkey());
            insertCommentEachAction("El archivo RFC se cargo correctamente");
        }
        if (archivo3 != null) {
            if (transitionShared.fileUploaded("R1", transitionBeanM.getKnkey())) {
                borraFtp("r1");
            }

            uploadFtp(archivo3, "r1");
            transitionShared.updateUploaded("R1", transitionBeanM.getKnkey());
            insertCommentEachAction("El archivo R1 se cargo correctamente");
        }
        if (archivo4 != null) {
            if (transitionShared.fileUploaded("R2", transitionBeanM.getKnkey())) {
                borraFtp("r2");
            }

            uploadFtp(archivo4, "r2");
            transitionShared.updateUploaded("R2", transitionBeanM.getKnkey());
            insertCommentEachAction("El archivo R2 se cargo correctamente");
        }
        if (archivo5 != null) {
            if (transitionShared.fileUploaded("Minimum Selling Rates", transitionBeanM.getKnkey())) {
                borraFtp("msr");
            }

            uploadFtp(archivo5, "msr");
            transitionShared.updateUploaded("Minimum Selling Rates", transitionBeanM.getKnkey());
            insertCommentEachAction("El archivo Minimun Selling Rates se cargo correctamente");
        }
        if (archivo6 != null) {
            if (transitionShared.fileUploaded("Sales Quotation", transitionBeanM.getKnkey())) {
                borraFtp("sales_quotation");
            }

            uploadFtp(archivo6, "sales_quotation");
            transitionShared.updateUploaded("Sales Quotation", transitionBeanM.getKnkey());
            insertCommentEachAction("El archivo Sales Quotation se cargo correctamente");
        }

        transitionShared.updateUploaded("Rate Tracker", transitionBeanM.getKnkey(), transitionBean.getRatetrackertext());
        transitionShared.updateUploaded("ACON Debtor Number", transitionBeanM.getKnkey(), transitionBean.getAcondebtornumbertext());

        ////////////////rellena nuevamente la lista de usuarios para q no se pierda en el metodo generarreportepdf
        UsuarioDto usuario = new UsuarioDto();
        usuario = (UsuarioDto) sesion.get("usuarioSession");
        TransitionBean transitionBeanNew = new TransitionBean();
        transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
        transitionBean = transitionBeanNew;

        personList = transitionShared.GetListaNombreDePersonal();
        detallesPersonD = transitionShared.GetDataPersonalByKnkey(transitionBean.getKnkey());

        usuarioT.setName(usuario.getName());
        transitionBean.setTime(transitionBean.getTime());
        transitionShared.GetDocumentName(transitionBean);
        transitionShared.GetJoindocumenttransitionData(transitionBean);
        String TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());

        /////rellena las pantallas de Client Info e If Owner Info
        setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
        AsignIfownerStkBean bean = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
        if (bean != null) {
            setCorreoIfOwnerInfo(bean.getIfownwer());
        }
        
         //////////////Valida los archivos cargados
        if(transitionServer.verifyUploaded("Customer Profile", transitionBeanM.getKnkey())){
            existe1 = true;
        }
        if(transitionServer.verifyUploaded("rfc", transitionBeanM.getKnkey())){
            existe2 = true;
        }
        if(transitionServer.verifyUploaded("R1", transitionBeanM.getKnkey())){
            existe3 = true;
        }
        if(transitionServer.verifyUploaded("R2", transitionBeanM.getKnkey())){
            existe4 = true;
        }
        if(transitionServer.verifyUploaded("Minimum Selling Rates", transitionBeanM.getKnkey())){
            existe5 = true;
        }
        if(transitionServer.verifyUploaded("Sales Quotation", transitionBeanM.getKnkey())){
            existe6 = true;
        }

        statusselected = transitionShared.GetStatusSelected(transitionBeanM.getKnkey());
        transitionBean.setAcondebtornumbertext(transitionShared.GetJoindocumenttransitionDetail(8, transitionBean.getId()));
        transitionBean.setRatetrackertext(transitionShared.GetJoindocumenttransitionDetail(6, transitionBean.getId()));

        if (TlogDB == null) {
            transitionBean.setTlog("");
            transitionShared.UpdateLogEnTransition(transitionBean);
            TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());
            setDatos(usuario.getName() + "  " + transitionShared.GetTheDateTime() + "  " + TlogDB);
        } else {
            setDatos(TlogDB);
        }

        if (usuario.getName().equals("STK                      ")) {
            return "knkeylist";
        } else {
            return SUCCESS;
        }
    }

    private String loadData(TransitionBean transitionBean) {
        UsuarioDto usuario = new UsuarioDto();
        try {

            statusList.add("On Hold");
            statusList.add("On Going");
            statusList.add("Canceled");
            statusList.add("Closed");
            statusList.add("Completed");

            transitionBeanM = new TransitionBean();
            TransitionShared transitionShared = new TransitionShared();

            detallesPersonD = transitionShared.GetDataPersonalByKnkey(transitionBean.getKnkey());
            personList = transitionShared.GetListaNombreDePersonal();

            personList = transitionShared.GetListaNombreDePersonal();

            transitionBeanM = transitionShared.GetTransitionBeanIdKnkey(transitionBean);
            transitionBeanM.setTime(transitionShared.GetTheDateTime());

            setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
            AsignIfownerStkBean bean = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
            if (bean != null) {
                setCorreoIfOwnerInfo(bean.getIfownwer());
            }

            statusselected = transitionShared.GetStatusSelected(transitionBeanM.getKnkey());

            String TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());
            if (TlogDB == null) {
                transitionBeanM.setTlog("");
                transitionShared.UpdateLogEnTransition(transitionBeanM);
                TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());

                setDatos(usuario.getName() + "  " + transitionShared.GetTheDateTime() + "  " + TlogDB);
            } else {
                setDatos(TlogDB);
            }

        } catch (Exception ex) {
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }

        if (usuario.getName().trim().equals("STK")) {
            return "knkeylist";
        } else {
            return SUCCESS;
        }
    }

    public String downFtp1() {
        return downFtp(0);
    }

    public String downFtp2() {
        return downFtp(1);
    }

    public String downFtp3() {
        return downFtp(2);
    }

    public String downFtp4() {
        return downFtp(3);
    }

    public String downFtp5() {
        return downFtp(4);
    }

    public String downFtp6() {
        return downFtp(5);
    }

    public String downFtp7() {
        return downFtp(6);
    }

    public String downFtp8() {
        return downFtp(7);
    }

    private String downFtp(int folder) {

        try {
            UsuarioDto user = new UsuarioDto();
            TransitionServer transitionServer = new TransitionServer();
            ActionContext contexto = ActionContext.getContext();
            Map<String, Object> sesion = contexto.getSession();
            user = (UsuarioDto) sesion.get("usuarioSession");
            Map<String, Object> sesion2 = contexto.getSession();
            transitionBeanM = (TransitionBean) sesion2.get("Knkey");


            String s = getS1();
            String knkey = String.valueOf(transitionBeanM.getKnkey());
            setNombreArchivo(knkey + ".7z");
            String Filename = knkey + ".7z";

            String[] folderArray = s1.split(",");
            ConexionFtp conexionFtp = new ConexionFtp(folderArray[folder].trim());
            pdfInputStream = conexionFtp.obtenInfo(Filename);

            if (pdfInputStream == null) {
                loadData(transitionBeanM);
                throw new CstF2Exception("No existe el archivo");
            }
            ////////Agrega en Tlog la accion hecha en este medoto
            insertCommentEachAction("Se descargo el archivo" + folderArray[folder] + " del ftp");
            
            //////////////Valida los archivos cargados
            if(transitionServer.verifyUploaded("Customer Profile", transitionBeanM.getKnkey())){
                existe1 = true;
            }
            if(transitionServer.verifyUploaded("rfc", transitionBeanM.getKnkey())){
                existe2 = true;
            }
            if(transitionServer.verifyUploaded("R1", transitionBeanM.getKnkey())){
                existe3 = true;
            }
            if(transitionServer.verifyUploaded("R2", transitionBeanM.getKnkey())){
                existe4 = true;
            }
            if(transitionServer.verifyUploaded("Minimum Selling Rates", transitionBeanM.getKnkey())){
                existe5 = true;
            }
            if(transitionServer.verifyUploaded("Sales Quotation", transitionBeanM.getKnkey())){
                existe6 = true;
            }

        } catch (IOException ex) {
            java.util.logging.Logger.getLogger(TransitionClient.class.getName()).log(Level.SEVERE, null, ex);
            addFieldError("Error al obtener el archivo", "Ocurrio un Error: error al descargar archivo. \n" + ex.getMessage());
            return ERROR_DOWN;
        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", ex.getMessage());
            return ERROR_DOWN;
        }
        return ZIP;

    }

    public String insertCheckboxes() {
        String checkboxes = "";
        UsuarioDto usuario = new UsuarioDto();
        ActionContext contexto = ActionContext.getContext();
        Map<String, Object> sesion = contexto.getSession();
        usuario = (UsuarioDto) sesion.get("usuarioSession");
        Map<String, Object> sesion2 = contexto.getSession();
        transitionBeanM = (TransitionBean) sesion2.get("Knkey");

        // crea una coleccion
        TransitionShared transitionShared = new TransitionShared();
        TransitionServer transitionServer = new TransitionServer();
        MainServer mainServer = new MainServer();
        transitionBeanM = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);
        ArrayList<Boolean> checkbox = new ArrayList<Boolean>();
        // agrega los valores recuperados por el atributo name de los checkboxes del formulario

        JoindocumenttransitionBean joindocumenttransitionBean = new JoindocumenttransitionBean();
        joindocumenttransitionBean.setCheckboxesVoBo(checkbox);

        joindocumenttransitionBean.setIdtransition(transitionBeanM.getId());
        
        //////////////rellena el branch
        branch = transitionServer.branch();
        valBranch = true;
        String msj = transitionServer.getLocality(transitionBeanM.getKnkey());
        if(msj != null)
            msjBranch = transitionServer.validateBranch(transitionBeanM.getKnkey()) + msj;

        //////////////Cambia el status
        mainServer.updatedTrue1(transitionBeanM.getKnkey());

        String cp, rfc, r1, r2, msr, rt, sq, adn;
        
        if(getBox1() == true)
            cp = "Confirmed";
        else
            cp = "Unconfirmed";
        
        checkboxes += "Customer Profile: " + cp + "\n";
        joindocumenttransitionBean.setVobo(getBox1());
        transitionShared.UpdateVoBoCheckbox(joindocumenttransitionBean, 1);

        if(getBox2() == true)
            rfc = "Confirmed";
        else
            rfc = "Unconfirmed";
        
        checkboxes += "RFC: " + rfc + "\n";
        joindocumenttransitionBean.setVobo(getBox2());
        transitionShared.UpdateVoBoCheckbox(joindocumenttransitionBean, 2);

        if(getBox3() == true)
            r1 = "Confirmed";
        else
            r1 = "Unconfirmed";
        
        checkboxes += "R1: " + r1 + "\n";
        joindocumenttransitionBean.setVobo(getBox3());
        transitionShared.UpdateVoBoCheckbox(joindocumenttransitionBean, 3);

        if(getBox4() == true)
            r2 = "Confirmed";
        else
            r2 = "Unconfirmed";
        
        checkboxes += "R2: " + r2 + "\n";
        joindocumenttransitionBean.setVobo(getBox4());
        transitionShared.UpdateVoBoCheckbox(joindocumenttransitionBean, 4);

        if(getBox5() == true)
            msr = "Confirmed";
        else
            msr = "Unconfirmed";
        
        checkboxes += "Minimun SallingRates: " + msr + "\n";
        joindocumenttransitionBean.setVobo(getBox5());
        transitionShared.UpdateVoBoCheckbox(joindocumenttransitionBean, 5);

        if(getBox6() == true)
            rt = "Confirmed";
        else
            rt = "Unconfirmed";
        
        checkboxes += "Rate Tracker: " + rt + "\n";
        joindocumenttransitionBean.setVobo(getBox6());
        transitionShared.UpdateVoBoCheckbox(joindocumenttransitionBean, 6);

        if(getBox7() == true)
            sq = "Confirmed";
        else
            sq = "Unconfirmed";
        
        checkboxes += "Sales Quotation: " + sq + "\n";
        joindocumenttransitionBean.setVobo(getBox7());
        transitionShared.UpdateVoBoCheckbox(joindocumenttransitionBean, 7);

        if(getBox8() == true)
            adn = "Confirmed";
        else
            adn = "Unconfirmed";
        
        checkboxes += "Acon Debtor Number: " + adn + "\n";
        joindocumenttransitionBean.setVobo(getBox8());
        transitionShared.UpdateVoBoCheckbox(joindocumenttransitionBean, 8);

        if (!transitionBean.getAcondebtornumbertext().trim().equals("")) {
            transitionShared.UpdateDetailsInJoindocumenttransition(transitionBean.getAcondebtornumbertext(), 8, joindocumenttransitionBean.getIdtransition());
        }

        if (!transitionBean.getRatetrackertext().trim().equals("")) {
            transitionShared.UpdateDetailsInJoindocumenttransition(transitionBean.getRatetrackertext(), 6, joindocumenttransitionBean.getIdtransition());
        }

        ////////Agrega en Tlog la accion hecha en este medoto
        insertCommentEachAction("Se actualizaron los Vistos Buenos: \n" + checkboxes);
        
        //////////////Valida los archivos cargados
            if(transitionServer.verifyUploaded("Customer Profile", transitionBeanM.getKnkey())){
                existe1 = true;
            }
            if(transitionServer.verifyUploaded("rfc", transitionBeanM.getKnkey())){
                existe2 = true;
            }
            if(transitionServer.verifyUploaded("R1", transitionBeanM.getKnkey())){
                existe3 = true;
            }
            if(transitionServer.verifyUploaded("R2", transitionBeanM.getKnkey())){
                existe4 = true;
            }
            if(transitionServer.verifyUploaded("Minimum Selling Rates", transitionBeanM.getKnkey())){
                existe5 = true;
            }
            if(transitionServer.verifyUploaded("Sales Quotation", transitionBeanM.getKnkey())){
                existe6 = true;
            }

        execute();
        return SUCCESS;
    }
    
    public String locality(){
        UsuarioDto usuario = new UsuarioDto();
        try {
            statusList.add("On Hold");
            statusList.add("On Going");
            statusList.add("Canceled");
            statusList.add("Closed");
            statusList.add("Completed");

            if (transitionBeanM != null) {
                ActionContext contexto = ActionContext.getContext();
                Map<String, Object> sesion = contexto.getSession();
                usuario = (UsuarioDto) sesion.get("usuarioSession");
                Map<String, Object> sesion2 = contexto.getSession();
                transitionBeanM = (TransitionBean) sesion2.get("Knkey");

                TransitionBean transitionBeanNew = new TransitionBean();
                TransitionShared transitionShared = new TransitionShared();
                AssignShared assignShared = new AssignShared();
                TransitionServer transitionServer = new TransitionServer();
                MainServer mainServer = new MainServer();
                transitionBeanNew = transitionShared.GetTransitionBeanIdKnkey(transitionBeanM);

                transitionBeanM = transitionBeanNew;   // aki empieza la confusion entre transitionBean y tansitionBeanM el primero con datos del jso y el otro con knkey e id

                usuarioT.setName(usuario.getName());

                setDatos(usuario.getName() + "  " + transitionShared.GetTheDateTime() + "   " + transitionBeanM.getTlog());

                personList = transitionShared.GetListaNombreDePersonal();
                statusselected = transitionShared.GetStatusSelected(transitionBeanM.getKnkey());
                
                MailSender mails = new MailSender();
                TransitionServer ts = new TransitionServer();
                ArrayList<String> correos = new ArrayList<String>();

                correos = ts.confirm(locality);
                System.out.println(correos);

                StringBuilder mensaje = new StringBuilder();
                mensaje.append("Transition iniciated KNKEY: ");
                mensaje.append(transitionBeanM.getKnkey());
                mensaje.append(" COMPANYNAME: ");
                mensaje.append(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname());

                mails.sendEmail(correos, "Transition", mensaje);

                ts.confirmated(transitionBeanM.getKnkey());
                ts.putLocality(transitionBeanM.getKnkey(), locality);
                mainServer.updatedTrue(transitionBeanM.getKnkey());


                /////rellena las pantallas de Client Info e If Owner Info
                setClientInfo(transitionShared.GetDataFromSTK(transitionBeanM).getCompanyname() + " - " + transitionShared.GetDataFromSTK(transitionBeanM).getComercialname());
                AsignIfownerStkBean bean = transitionShared.GetIfOwnerFromSTK(transitionBeanM);
                if (bean != null) {
                    setCorreoIfOwnerInfo(bean.getIfownwer());
                }

                ////////Agrega en Tlog la accion hecha en este medoto
                insertCommentEachAction("Los usuarios de " + locality + " fueron notificados y asigandos");

                //rellena la tabla dinamica operations information
                detallesPersonD = transitionShared.GetDataPersonalByIdPersonal(transitionBean.getId());

                //rellena los checkbox de attachments
                JoindocumenttransitionBean joindocumenttransitionBean = new JoindocumenttransitionBean();
                joindocumenttransitionBean = (transitionShared.GetVoBoInJoindocumenttransition(transitionBean.getId()));
                voBos = joindocumenttransitionBean.getCheckboxesVoBo();
                box1 = voBos.get(0);
                box2 = voBos.get(1);
                box3 = voBos.get(2);
                box4 = voBos.get(3);
                box5 = voBos.get(4);
                box6 = voBos.get(5);
                box7 = voBos.get(6);
                box8 = voBos.get(7);

                //llena los texfields de attachments    
                joindocumenttransitionBean = transitionShared.GetJoindocumenttransitionData(transitionBean);
                
                //////////////rellena el branch
                branch = transitionServer.branch();
                valBranch = true;
                String msj = transitionServer.getLocality(transitionBeanM.getKnkey());
                if(msj != null)
                    msjBranch = transitionServer.validateBranch(transitionBeanM.getKnkey()) + msj;
                
                //////////////Cambia el status
                mainServer.updatedTrue(transitionBeanM.getKnkey());
                mainServer.updatedTrue1(transitionBeanM.getKnkey());
                
                //////////////Valida los archivos cargados
                if(transitionServer.verifyUploaded("Customer Profile", transitionBeanM.getKnkey())){
                    existe1 = true;
                }
                if(transitionServer.verifyUploaded("rfc", transitionBeanM.getKnkey())){
                    existe2 = true;
                }
                if(transitionServer.verifyUploaded("R1", transitionBeanM.getKnkey())){
                    existe3 = true;
                }
                if(transitionServer.verifyUploaded("R2", transitionBeanM.getKnkey())){
                    existe4 = true;
                }
                if(transitionServer.verifyUploaded("Minimum Selling Rates", transitionBeanM.getKnkey())){
                    existe5 = true;
                }
                if(transitionServer.verifyUploaded("Sales Quotation", transitionBeanM.getKnkey())){
                    existe6 = true;
                }
                
                //////////////Enviar Correo
                ArrayList<Integer> insertKnkeys = new ArrayList<Integer>();
                insertKnkeys.add(transitionBeanM.getKnkey());
                ArrayList<Integer> idTransitions = assignShared.GetIdTransition(insertKnkeys);
                ArrayList<Integer> ids = ts.confirm2(locality);
                for (Integer id : ids){
                    assignShared.InsertRelationUserKnkey(id, idTransitions);
                }
                
                //////////////rellena la pantalla transitionLog
                String TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());
                if (TlogDB == null) {
                    transitionBean.setTlog("");
                    transitionShared.UpdateLogEnTransition(transitionBean);
                    TlogDB = transitionShared.GetTransitionLog(transitionBeanM.getKnkey());

                    setDatos(usuario.getName() + "  " + transitionShared.GetTheDateTime() + "  " + TlogDB);
                } else {
                    setDatos(TlogDB);
                }
            } else {
                log.info("No hay Knkeys asignadas.");
                addFieldError("KnkeyIncorrecta", "No hay Knkeys asignadas.");
                return ERROR_SESSION;
            }
        } catch (CstF2Exception ex) {
            log.error("ERROR. ", ex);
            addFieldError("KnkeyIncorrecta", "Ocurrio un Error: " + ex.getMessage());
            return ERROR_SESSION;
        }

        if (usuario.getName().equals("STK                      ")) {
            return "knkeylist";
        } else {
            return SUCCESS;
        }
    }

    public Boolean getValBranch() {
        return valBranch;
    }

    public void setValBranch(Boolean valBranch) {
        this.valBranch = valBranch;
    }

    public String getMsjBranch() {
        return msjBranch;
    }

    public void setMsjBranch(String msjBranch) {
        this.msjBranch = msjBranch;
    }

    public static java.sql.Date convertToSqlDate(java.util.Date oDate) {
        return (new java.sql.Date(oDate.getTime()));
    }
    
    public String getLocality() {
        return locality;
    }

    public void setLocality(String locality) {
        this.locality = locality;
    }
    
    public ArrayList<Localidad> getBranch() {
        return branch;
    }

    public void setBranch(ArrayList<Localidad> branch) {
        this.branch = branch;
    }
    
    public TransitionBean getTransitionBeanM() {
        return transitionBeanM;
    }

    public void setTransitionBeanM(TransitionBean transitionBeanM) {
        this.transitionBeanM = transitionBeanM;
    }

    public Integer getDocumentId() {
        return documentId;
    }

    public void setDocumentId(Integer documentId) {
        this.documentId = documentId;
    }

    public ArrayList<Boolean> getVoBos() {
        return voBos;
    }

    public void setVoBos(ArrayList<Boolean> voBos) {
        this.voBos = voBos;
    }
    private String s1 = "";
    private String nombreArchivo = "";

    public String getNombreArchivo() {
        return nombreArchivo;
    }

    public void setNombreArchivo(String nombreArchivo) {
        this.nombreArchivo = nombreArchivo;
    }

    public Boolean getBox1aux() {
        return box1aux;
    }

    public void setBox1aux(Boolean box1aux) {
        this.box1aux = box1aux;
    }

    public Boolean getBox2aux() {
        return box2aux;
    }

    public void setBox2aux(Boolean box2aux) {
        this.box2aux = box2aux;
    }

    public Boolean getBox3aux() {
        return box3aux;
    }

    public void setBox3aux(Boolean box3aux) {
        this.box3aux = box3aux;
    }

    public Boolean getBox4aux() {
        return box4aux;
    }

    public void setBox4aux(Boolean box4aux) {
        this.box4aux = box4aux;
    }

    public Boolean getBox5aux() {
        return box5aux;
    }

    public void setBox5aux(Boolean box5aux) {
        this.box5aux = box5aux;
    }

    public Boolean getBox6aux() {
        return box6aux;
    }

    public void setBox6aux(Boolean box6aux) {
        this.box6aux = box6aux;
    }

    public Boolean getBox7aux() {
        return box7aux;
    }

    public void setBox7aux(Boolean box7aux) {
        this.box7aux = box7aux;
    }

    public Boolean getBox8aux() {
        return box8aux;
    }

    public void setBox8aux(Boolean box8aux) {
        this.box8aux = box8aux;
    }

    public String getS1() {
        return s1;
    }

    public void setS1(String s1) {
        this.s1 = s1;
    }

    public Boolean getBox1() {
        return box1;
    }

    public void setBox1(Boolean box1) {
        this.box1 = box1;
    }

    public Boolean getBox2() {
        return box2;
    }

    public void setBox2(Boolean box2) {
        this.box2 = box2;
    }

    public Boolean getBox3() {
        return box3;
    }

    public void setBox3(Boolean box3) {
        this.box3 = box3;
    }

    public Boolean getBox4() {
        return box4;
    }

    public void setBox4(Boolean box4) {
        this.box4 = box4;
    }

    public Boolean getBox5() {
        return box5;
    }

    public void setBox5(Boolean box5) {
        this.box5 = box5;
    }

    public Boolean getBox6() {
        return box6;
    }

    public void setBox6(Boolean box6) {
        this.box6 = box6;
    }

    public Boolean getBox7() {
        return box7;
    }

    public void setBox7(Boolean box7) {
        this.box7 = box7;
    }

    public Boolean getBox8() {
        return box8;
    }

    public void setBox8(Boolean box8) {
        this.box8 = box8;
    }

    public static Logger getLog() {
        return log;
    }

    public static void setLog(Logger log) {
        TransitionClient.log = log;
    }

    public String getClientInfo() {
        return ClientInfo;
    }

    public void setClientInfo(String ClientInfo) {
        this.ClientInfo = ClientInfo;
    }

    public String getCorreoIfOwnerInfo() {
        return CorreoIfOwnerInfo;
    }

    public void setCorreoIfOwnerInfo(String CorreoIfOwnerInfo) {
        this.CorreoIfOwnerInfo = CorreoIfOwnerInfo;
    }

    public Integer getIdDownloadFtp() {
        return idDownloadFtp;
    }

    public void setIdDownloadFtp(Integer idDownloadFtp) {
        this.idDownloadFtp = idDownloadFtp;
    }

    public ArrayList<PersonalBean> getNewArrayPerson() {
        return newArrayPerson;
    }

    public void setNewArrayPerson(ArrayList<PersonalBean> newArrayPerson) {
        this.newArrayPerson = newArrayPerson;
    }
    private ArrayList<PersonalBean> detallesPersonG = new ArrayList<PersonalBean>();

    public int getIndex() {
        return index;
    }

    public void setIndex(int index) {
        this.index = index;
    }

    public PersonalBean getPb() {
        return pb;
    }

    public void setPb(PersonalBean pb) {
        this.pb = pb;
    }

    public ArrayList<PersonalBean> getDetallesPersonG() {
        return detallesPersonG;
    }

    public void setDetallesPersonG(ArrayList<PersonalBean> detallesPersonG) {
        this.detallesPersonG = detallesPersonG;
    }

    public ArrayList<PersonalBean> getDetallesPersonD() {
        return detallesPersonD;
    }

    public void setDetallesPersonD(ArrayList<PersonalBean> detallesPersonD) {
        this.detallesPersonD = detallesPersonD;
    }

    public String getPerson() {
        return person;
    }

    public void setPerson(String person) {
        this.person = person;
    }

    public ArrayList<String> getPersonList() {
        return personList;
    }

    public void setPersonList(ArrayList<String> personList) {
        this.personList = personList;
    }

    public String getDatos() {
        return datos;
    }

    public void setDatos(String datos) {
        this.datos = datos;
    }

    public UsuarioDto getUsuarioT() {
        return usuarioT;
    }

    public void setUsuarioT(UsuarioDto usuarioT) {
        this.usuarioT = usuarioT;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public TransitionBean getTransitionBean() {
        return transitionBean;
    }

    public void setTransitionBean(TransitionBean transitionBean) {
        this.transitionBean = transitionBean;
    }

    public String getKnkey() {
        return knkey;
    }

    public void setKnkey(String knkey) {
        this.knkey = knkey;
    }

    public ArrayList<String> getStatusList() {
        return statusList;
    }

    public void setStatusList(ArrayList<String> statusList) {
        this.statusList = statusList;
    }

    public InputStream getPdfInputStream() {
        return pdfInputStream;
    }

    public void setPdfInputStream(InputStream pdfInputStream) {
        this.pdfInputStream = pdfInputStream;
    }
    private String statusselected;

    public String getStatusselected() {
        return statusselected;
    }

    public void setStatusselected(String statusselected) {
        this.statusselected = statusselected;
    }
    private ArrayList<TransitionBean> transitionBeanArray;

    public ArrayList<TransitionBean> getTransitionBeanArray() {
        return transitionBeanArray;
    }

    public void setTransitionBeanArray(ArrayList<TransitionBean> transitionBeanArray) {
        this.transitionBeanArray = transitionBeanArray;
    }

    public File getArchivo1() {
        return archivo1;
    }

    public void setArchivo1(File archivo1) {
        this.archivo1 = archivo1;
    }

    public File getArchivo2() {
        return archivo2;
    }

    public void setArchivo2(File archivo2) {
        this.archivo2 = archivo2;
    }

    public File getArchivo3() {
        return archivo3;
    }

    public void setArchivo3(File archivo3) {
        this.archivo3 = archivo3;
    }

    public File getArchivo4() {
        return archivo4;
    }

    public void setArchivo4(File archivo4) {
        this.archivo4 = archivo4;
    }

    public File getArchivo5() {
        return archivo5;
    }

    public void setArchivo5(File archivo5) {
        this.archivo5 = archivo5;
    }

    public File getArchivo6() {
        return archivo6;
    }

    public void setArchivo6(File archivo6) {
        this.archivo6 = archivo6;
    }

    public File getArchivo7() {
        return archivo7;
    }

    public void setArchivo7(File archivo7) {
        this.archivo7 = archivo7;
    }

    public File getArchivo8() {
        return archivo8;
    }

    public void setArchivo8(File archivo8) {
        this.archivo8 = archivo8;
    }

    public Integer getKNKEY() {
        return KNKEY;
    }

    public void setKNKEY(Integer KNKEY) {
        this.KNKEY = KNKEY;
    }

    public Boolean getExiste1() {
        return existe1;
    }

    public void setExiste1(Boolean existe1) {
        this.existe1 = existe1;
    }

    public Boolean getExiste2() {
        return existe2;
    }

    public void setExiste2(Boolean existe2) {
        this.existe2 = existe2;
    }

    public Boolean getExiste3() {
        return existe3;
    }

    public void setExiste3(Boolean existe3) {
        this.existe3 = existe3;
    }

    public Boolean getExiste4() {
        return existe4;
    }

    public void setExiste4(Boolean existe4) {
        this.existe4 = existe4;
    }

    public Boolean getExiste5() {
        return existe5;
    }

    public void setExiste5(Boolean existe5) {
        this.existe5 = existe5;
    }

    public Boolean getExiste6() {
        return existe6;
    }

    public void setExiste6(Boolean existe6) {
        this.existe6 = existe6;
    }
    
}
